package com.huiyuanai.film.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.huiyuanai.film.entity.User;
import com.huiyuanai.film.mapper.UserMapper;
import com.huiyuanai.film.query.UserQuery;
import com.huiyuanai.film.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 灰原哀
 * @since 2022-05-27
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public PageInfo<User> userPage(UserQuery userQuery) {
        PageHelper.startPage(userQuery.getCurrentPage(), userQuery.getPageSize());
        Page<User> users = (Page<User>) userMapper.userPage(userQuery);
        return users.toPageInfo();
    }
}
